<?php
$this->Html->scriptBlock($scriptSearchBox, array('inline' => false));
$this->Html->scriptBlock($scriptSearchBox2, array('inline' => false));
?>
<div class="title-body-content"><?php echo $title_for_layout; ?></div>
<div class="searchbox" style="margin-top: 15px;">
    From &nbsp;<input type="text" id="match_from_id" readonly="readonly" value="<?php echo date('m/d/Y');?>" class="sel-date" name="match_from" />
    &nbsp;&nbsp;To &nbsp;<input type="text" id="match_to_id" readonly="readonly" value="<?php echo date('m/d/Y', strtotime(date('Y-m-d H:i:s'))+7*24*60*60);?>" class="sel-date" name="match_to" />
    <input type="button" id="search_button" value="Search" class="searchbutton" />
</div>
<div class="wrapper-table clearfix">
<?php
echo $calendar;
?>
</div>

<!--
<table border="0" cellspacing="1" cellpadding="0" class="mainTableTOC">
    <tr>
        <td title="Easy PHP Calendar 7" colspan="7" class="monthYearRowTOC">  
            <table width="100%">
                <tr>
                    <td class="monthYearTextTOC">August 2012</td>
                    <td style="text-align: right;">
                        <select id="mo" class="formElements" name="mo">
                            <option value="1">January</option>
                            <option value="2">February</option>
                            <option value="3">March</option>
                            <option value="4">April</option>
                            <option value="5">May</option>
                            <option value="6">June</option>
                            <option value="7">July</option>
                            <option selected="selected" value="8">August</option>
                            <option value="9">September</option>
                            <option value="10">October</option>
                            <option value="11">November</option>
                            <option value="12">December</option>
                        </select>
                        <select id="yr" class="formElements" name="yr">
                            <option>2000</option>
                            <option>2001</option>
                            <option>2002</option>
                            <option>2003</option>
                            <option>2004</option>
                            <option>2005</option>
                            <option>2006</option>
                            <option>2007</option>
                            <option>2008</option>
                            <option>2009</option>
                            <option>2010</option>
                            <option>2011</option>
                            <option selected="selected">2012</option>
                            <option>2013</option>
                            <option>2014</option>
                            <option>2015</option>
                            <option>2016</option>
                            <option>2017</option>
                            <option>2018</option>
                            <option>2019</option>
                            <option>2020</option>
                        </select>
                        <input type="submit" value="Go" id="dateChange" class="formButtons" name="dateChange" />
                        <input type="button" class="formButtons" value="&lt;&lt;" id="epcprev" name="epcprev" />
                        <input type="button" class="formButtons" value="&gt;&gt;" id="next" name="next" />
                    </td>
                </tr>
            </table>
        </td>
    </tr>
    <tr class="dayNamesTextTOC">
        <td class="dayNamesRowTOC">Sunday</td>
        <td class="dayNamesRowTOC">Monday</td>
        <td class="dayNamesRowTOC">Tuesday</td>
        <td class="dayNamesRowTOC">Wednesday</td>
        <td class="dayNamesRowTOC">Thursday</td>
        <td class="dayNamesRowTOC">Friday</td>
        <td class="dayNamesRowTOC">Saturday</td>
    </tr>
    <tr class="rowsTOC">
        <td class="sOtherTOC">29</td>
        <td class="sOtherTOC">30</td>
        <td class="sOtherTOC">31</td>
        <td class="s20TOC"><div class="daynumTOC">1</div></td>
        <td class="s20TOC"><div class="daynumTOC">2</div></td>
        <td class="s20TOC"><div class="daynumTOC">3</div></td>
        <td style="cursor: pointer;" class="s20TOC0">
            <div class="daynumTOC">4</div>
            <div class="titleTOC"><span class="s24">&nbsp;&nbsp;</span>HTML Example </div>
        </td>
    </tr>
    <tr class="rowsTOC">
        <td style="cursor: pointer;" class="s20TOC0">
            <div class="daynumTOC">5</div>
            <div class="titleTOC"><span class="s24">&nbsp;&nbsp;</span>HTML Example </div>
        </td>
        <td class="s20TOC"><div class="daynumTOC">6</div></td>
        <td class="s20TOC"><div class="daynumTOC">7</div></td>
        <td class="s20TOC"><div class="daynumTOC">8</div></td>
        <td style="cursor: pointer;" class="s20TOC">
            <div class="daynumTOC">9</div><div class="titleTOC"><span class="s21">&nbsp;&nbsp;</span>Occurs the 9th of every month </div>
        </td>
        <td class="s20TOC"><div class="daynumTOC">10</div></td>
        <td class="s20TOC0"><div class="daynumTOC">11</div></td>
    </tr>
    <tr class="rowsTOC">
        <td class="s20TOC0"><div class="daynumTOC">12</div></td>
        <td class="s20TOC"><div class="daynumTOC">13</div></td>
        <td class="s20TOC"><div class="daynumTOC">14</div></td>
        <td class="s20TOC"><div class="daynumTOC">15</div></td>
        <td class="s20TOC"><div class="daynumTOC">16</div></td>
        <td class="s20TOC"><div class="daynumTOC">17</div></td>
        <td class="s20TOC0"><div class="daynumTOC">18</div></td>
    </tr>
    <tr class="rowsTOC">
        <td class="s20TOC0"><div class="daynumTOC">19</div></td>
        <td style="cursor: pointer;" class="s20TOC">
            <div class="daynumTOC">20</div><div class="titleTOC"><span class="s23">&nbsp;&nbsp;</span>Third Monday of Every Month </div>
        </td>
        <td style="cursor: pointer;" class="s20TOC">
            <div class="daynumTOC">21</div><div class="titleTOC"><span class="s23">&nbsp;&nbsp;</span>Third Monday of Every Month </div>
        </td>
        <td style="cursor: pointer;" class="s20TOC">
            <div class="daynumTOC">22</div><div class="titleTOC"><span class="s23">&nbsp;&nbsp;</span>Third Monday of Every Month </div>
        </td>
        <td style="cursor: pointer;" class="s20TOC">
            <div class="daynumTOC">23</div><div class="titleTOC"><span class="s23">&nbsp;&nbsp;</span>Third Monday of Every Month </div>
        </td>
        <td class="s20TOC"><div class="daynumTOC">24</div></td>
        <td class="s20TOC0"><div class="daynumTOC">25</div></td>
    </tr>
    <tr class="rowsTOC">
        <td class="s20TOC0"><div class="daynumTOC">26</div></td>
        <td class="s20TOC"><div class="todayTOC">27</div></td>
        <td class="s20TOC"><div class="daynumTOC">28</div></td>
        <td class="s20TOC"><div class="daynumTOC">29</div></td>
        <td class="s20TOC"><div class="daynumTOC">30</div></td>
        <td class="s20TOC"><div class="daynumTOC">31</div></td>
        <td class="sOtherTOC">1</td>
    </tr>
    <tr class="rowsTOC">
        <td class="sOtherTOC">2</td>
        <td class="sOtherTOC">3</td>
        <td class="sOtherTOC">4</td>
        <td class="sOtherTOC">5</td>
        <td class="sOtherTOC">6</td>
        <td class="sOtherTOC">7</td>
        <td class="sOtherTOC">8</td>
    </tr>
</table>
-->

<?php
$datePicker = "
    $(function() {
        var childWin;
        $('a[rel=\"reminder\"]').click( function() {
            childWin = window.open($(this).attr('href'), 'child', 'modal,width=440,height=280,scrollbars=yes');
            return false;
        });
        
        $('#match_from_id').datepicker({ changeYear: true, dateFormat: 'm/d/yy'});
        $('#match_to_id').datepicker({ changeYear: true, dateFormat: 'm/d/yy'});
        
        $('a.qtip2').each(function() {
            var space_left = (screen.width*1 - 968)/2 + 548;
            var my_var = 'bottom left';
            var at_var = 'top left';
            if($(this).offset().left > space_left) {
                my_var = 'bottom right';
                at_var = 'top left';
            }
            
            $(this).qtip({
                content: {
                    text: '".$this->Html->image('/img/ajax/circle_ball.gif')."', 
                    ajax: {
                        url: 'http://".$_SERVER['HTTP_HOST']."' + $(this).attr('href').replace('view', 'ajax_qtip2'), // Use the rel attribute of each element for the url to load
                        type: 'GET'
                    },
                    title: {
                        text: 'Reminder Detail',
                        button: true
                    }
                },
                position: {
                    my: my_var, // Use the corner...
                    at: at_var // ...and opposite corner
                },
                hide: 'unfocus',
                style: {
                    classes: 'ui-tooltip-shadow ui-tooltip-tipped'
                }
            });
        });
        
        return false;
    });";

$this->Html->scriptBlock($datePicker, array('inline' => false));
?>